package com.luanye.enjoy.controller;

import com.luanye.enjoy.service.BaikeService;
import com.luanye.enjoy.vo.RespBean;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/plant")
@AllArgsConstructor
public class BaiKeController {

    private final BaikeService baikeService;

    @GetMapping("/get/{typeId}") // 默认 0 为杂草， 1 为 植物
    public RespBean getList( @PathVariable("typeId") Integer typeId ){
        return baikeService.getByTypeId(typeId);
    }

    @GetMapping("/getById/{id}")
    public RespBean getById(@PathVariable("id") Long id){
        return baikeService.getBreviaryById(id);
    }
}
